package com.echo.entity;

import java.util.Date;
import java.util.List;

/**
 * 评论实体类
 */
public class Comment {
    private Integer id;          // 评论ID
    private Integer articleId;   // 文章ID
    private Integer userId;      // 用户ID
    private String username;     // 用户名（非数据库字段）
    private String content;      // 评论内容
    private Integer parentId;    // 父评论ID，用于嵌套回复（null表示顶级评论）
    private Date createTime;     // 创建时间
    private Integer isDeleted;   // 是否已删除（0：未删除，1：已删除）
    private List<Comment> replies;  // 回复列表（非数据库字段）

    // getter和setter方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getArticleId() {
        return articleId;
    }

    public void setArticleId(Integer articleId) {
        this.articleId = articleId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }



    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }



    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public List<Comment> getReplies() {
        return replies;
    }

    public void setReplies(List<Comment> replies) {
        this.replies = replies;
    }

    @Override
    public String toString() {
        return "Comment{" +
                "id=" + id +
                ", articleId=" + articleId +
                ", userId=" + userId +
                ", username='" + username + "'" +
                ", content='" + content + "'" +
                ", parentId=" + parentId +
                ", createTime=" + createTime +
                ", isDeleted=" + isDeleted +
                ", replies.size=" + (replies != null ? replies.size() : 0) +
                "}";
    }
}